<template>
  <div>
    <NavBar>
      <div slot="left" class="back">
        <div @click="clickImg"><img src="~assets/img/common/back.svg" /></div>
      </div>
      <div class="detail-center" slot="center">
        <div class="detail-title" v-for="(value, index) of titles" :key="index" @click="btnTitle(index)" :class="{colorStyle:current==index}  ">
          {{ value }}
        </div>
      </div>
    </NavBar>
  </div>
</template>

<script>
import NavBar from "components/common/navbar/NavBar";
export default {
  name: "DetailNavBar",
  components: {
    NavBar,
  },
  data() {
    return {
      titles: ["商品", "参数", "评论", "推荐"],
      current: 0,
    };
  },
  methods: {
    btnTitle(index) {
      console.log(index);
      this.current = index;
      this.$emit("btnTitle", index);
    },
    clickImg() {
      console.log("asdasdsa");
      this.$router.back();
     
    },
  },
};
</script>

<style scoped>
.detail-center {
  display: flex;
  font-size: 15px;
}
.detail-title {
  flex: 1;
}
.colorStyle {
  color: var(--color-tint);
}
.back {
  margin-top: 7px;
}
</style>